<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
 <head>
  <title>设备信息</title>
  <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  <script type="text/javascript">
  //编写自定义JS代码
  </script>
 </head>
 <body>
  <t:formvalid formid="formobj" dialog="true"   layout="table" action="deviceTypeController.do?doSetOpenTime" tiptype="3" >
		
		<input id="id" name="id" type="hidden" value="${device.id }"> 
		<table style=" " cellpadding="0" cellspacing="1" class="formtable">
				<tr>
					<td align="right" style="width:80px;">
						<label class="Validform_label">
							开始时间:
						</label>
					</td>
					<td class="value">
					    <input id="openTimeBegin" name="openTimeBegin" type="text" 
					    	value="<fmt:formatDate  value='${device.openTimeBegin}' pattern='yyyy-MM-dd HH:mm'/>"
					    	style="width: 130px" class="inputxt"  datatype="*">
						<span class="Validform_checktip"></span>
						<label class="Validform_label" style="display: none;">开始时间</label>
					</td>
				</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							结束时间:
						</label>
					</td>
					<td class="value">
					    <input id="openTimeEnd" name="openTimeEnd" type="text" 
					    	value="<fmt:formatDate  value='${device.openTimeEnd}' pattern='yyyy-MM-dd HH:mm'/>"
					    	style="width: 130px" class="inputxt" datatype="*">
						<span class="Validform_checktip"></span>
						<label class="Validform_label" style="display: none;">结束时间</label>
					</td>
				</tr> 
			</table>
		</t:formvalid>
 </body>
 <script>
 	 
 $(document).ready(function(){
	 $("#openTimeBegin").attr("class","Wdate").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});}); 
	 $("#openTimeEnd").attr("class","Wdate").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});});  
	 
	 $('#openTimeBegin').bind('input propertychange', function() {
		 $('#openTimeEnd').focus();
	});
	 
	 $('#openTimeEnd').bind('input propertychange', function() {
		 $('#openTimeBegin').focus();
	});
	 
  });
 
 function validateDate(){
	 var begin = $("#openTimeBegin").val();
	 var end =  $("#openTimeEnd").val();
	 
	 var begin = new Date(begin.replace(/-/g,"/"));
	 var now  = new Date();
	/*  if(now - begin > 0){
		 tip("开始时间不能大于当前时间！");
		 return false;
	 }
	  */
	 if(begin > end){
		 tip("设备开放结束时间不能大于开始时间！");
		 return false;		 
	 }else{
		 return true;
	 } 
 }
 	
 </script>
 